<?php
if (!isset($contacts)) {
    echo "No Contacts Found";
    return;
}
?>

<div class='panel'>

    <div class="panel-heading p-xs">
        <div class='row'>
            <div class='col-lg-6 p-l-lg'>
                <!--<a href='#' class='btn btn-sm btn-white'><i class='fa fa-user'></i> Add Contact</a>-->
                <h5><?php echo $list['name']; ?></h5>
            </div>
            
            <div class='col-lg-6'>
                <!--<form class='form form-horizontal'>
                    <div class='row'>
                        <div class='col-sm-2 control-label'>Search:</div>
                        <div class='col-sm-10 controls'>
                            <input type='search' class='form-control input-sm' placeholder="Find contacts in this list" />
                        </div>
                    </div>
                </form>-->
            </div>
        </div>
    </div>

    <table class='table table-condensed table-bordered table-striped text-sm'>
        <thead>
            <tr>
                <!--<th class='text-right' width='50px;'><input type='checkbox' /></th>-->
                <th colspan='2'>Name</th>
                <th>Phone Number</th>
                <th>Birth Date</th>
                <th>Occupation</th>
                <th>Gender</th>
                <!--<th>Options</th>-->
            </tr>
        </thead>

        <tbody>
            <?php
            $count = 1;
            foreach ($contacts as $contact) {
                ?>
                <tr>
                    <td width='50' class='text-right'>
                        <!--<input type='checkbox' />-->
                        <?php echo $count++ . '. '; ?>
                    </td>
                    <td><?php echo $contact['full_name']; ?></td>
                    <td><?php echo $contact['number']; ?></td>
                    <td><?php echo date('M d', strtotime($contact['dob'])); ?></td>
                    <td><?php echo $contact['occupation']; ?></td>
                    <td><?php echo ucfirst($contact['gender']); ?></td>
                </tr>
            <?php } ?>
        </tbody>
    </table>

    <footer class="panel-footer">
        <div class="row">
            <div class="col-sm-4 hidden-xs">
                <!--<select class="input-sm form-control input-s-sm inline">
                    <option value="0">Bulk action</option>
                    <option value="1">Delete selected</option>
                    <option value="2">Bulk edit</option>
                    <option value="3">Export</option>
                </select>
                <button class="btn btn-sm btn-white">Apply</button>-->   
                
                <?php if( $list['type'] == 'custom' ) { ?>
                <button href='<?php echo $this->Html->url(array('action' => 'broadcast_list_create', $list['id'])); ?>' type='button' id='edit_list_btn' class='btn btn-sm btn-info'>
                    <i class='fa fa-chevron-left'></i> Edit List
                </button>
                <?php } ?>
            </div>
            <div class="col-sm-4 text-center">
                <small class="text-muted inline m-t-sm m-b-sm">showing 1 - <?php echo count($contacts); ?> of <?php echo $list['size']; ?> records</small>
            </div>
            <!--<div class="col-sm-4 text-right text-center-xs">                
                <ul class="pagination pagination-sm m-t-none m-b-none">
                    <li><a href="#"><i class="fa fa-chevron-left"></i></a></li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li><a href="#"><i class="fa fa-chevron-right"></i></a></li>
                </ul>
            </div>-->
        </div>
    </footer>
</div>

